#!/bin/bash
#
#备份现有yum源

mkdir /etc/yum.repos.d/bak
mv /etc/yum.repo.d/*.repo /etc/yum.repos.d/bak

#挂载光盘
echo '/dev/sr0	/mnt	iso9660	defaults	0 0' >> /etc/fstab
mount -a

#编写本地yum源文件
cat << eof
[local]
name=local
baseurl=file:///mnt
enable=1
gpgcheck=0
eof

yum clean all &> /dev/null
yum repolist

